package com.bwie.controller;

import com.bwie.pojo.He;
import com.bwie.pojo.Shop;
import com.bwie.service.ShopService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.apache.ibatis.annotations.Update;
import org.checkerframework.checker.optional.qual.Present;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/shop/index")
public class IndexController {

    @Autowired
    ShopService shopService;

    /**
     * 列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/shopList")
    public R shopList(@RequestBody PageInfoVo pageInfoVo){

        return shopService.shopList(pageInfoVo);
    }

    /**
     * 添加合同列表
     * @param shop
     * @return
     */
    @PostMapping("/addHeList")
    public R addHeList(@RequestBody Shop shop){
        return shopService.addHeList(shop);
    }

    /**
     * 图片上传
     * @param file
     * @return
     */
    @PostMapping("/sendFile")
    public R sendFile(@RequestPart(name = "file") MultipartFile file){
        return shopService.sendFile(file);
    }

    /**
     * 下拉框
     * @param dictId
     * @return
     */
    @PostMapping("/dictList/{dictId}")
    public R dictList(@PathVariable(name = "dictId")Integer dictId){
        return shopService.dictList(dictId);
    }
    /**
     * 合同列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/heList")
    public R heList(@RequestBody PageInfoVo pageInfoVo){

        return shopService.heList(pageInfoVo);
    }


    /**
     * 删除
     * @param shopId
     * @return
     */
    @DeleteMapping("/deleteList/{shopId}")
    public R deleteList(@PathVariable(name = "shopId") Integer shopId){
        return shopService.deleteList(shopId);
    }

    /**
     * 修改
     * @param shop
     * @return
     */
    @PutMapping("/putList")
    public R putList(@RequestBody Shop shop){
        return shopService.putList(shop);
    }


}
